

AS = nasm
ASFLAGS = -f bin -o $@ $<

BINS = Floppy.img Bootsector.bin Loader.bin
BOOT_SOURCES = bootsector/main.o 
LOAD_SOURCES = loader/main.o

ALLSS = $(BINS) $(BOOT_SOURCES) $(LOAD_SOURCES)


.s.o:
	$(AS) $(ASFLAGS)

Bootsector.bin: $(BOOT_SOURCES)
	@cp $< $@
Loader.bin: $(LOAD_SOURCES)
	@cp $< $@
Floppy.img:
	dd if=/dev/zero of=Floppy.img bs=512 count=2880

all: $(BINS)
	dd if=Bootsector.bin of=Floppy.img conv=notrunc
	
	hdiutil mount Floppy.img
	@cp Loader.bin /Volumes/BOOTPROG
	hdiutil unmount /Volumes/BOOTPROG
	
clean:
	@ -rm $(ALLSS)


